<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/1998/REC-html40-19980424/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>H</title>
<link rel="stylesheet" href="doc.css" type="text/css">
</head>
<body>

<h1>H</h1>

<dl>

<dt><a name="*Hup"><code>*Hup</code></a>
<dd>Global variable holding a (possibly empty) <code>prg</code> body, which will
be executed when a SIGHUP signal is sent to the current process. See also
<code><a href="refA.html#alarm">alarm</a></code>, <code><a
href="refS.html#sigio">sigio</a></code> and <code><a
href="refS.html#*Sig1">*Sig[12]</a></code>.

<pre><code>
: (de *Hup (msg 'SIGHUP))
-> *Hup
</code></pre>

<dt><a name="+Hook"><code>+Hook</code></a>
<dd>Prefix class for <code><a href="refR.html#+relation">+relation</a></code>s,
typically <code><a href="refL.html#+Link">+Link</a></code> or <code><a
href="refJ.html#+Joint">+Joint</a></code>. In essence, this maintains an local
database in the referred object. See also <a href="ref.html#dbase">Database</a>.

<pre><code>
(rel sup (+Hook +Link) (+Sup))   # Supplier
(rel nr (+Key +Number) sup)      # Item number, unique per supplier
(rel dsc (+Ref +String) sup)     # Item description, indexed per supplier
</code></pre>

<dt><a name="+Hook2"><code>+Hook2</code></a>
<dd>Prefix class for <code><a href="refI.html#+index">+index</a></code>
relations. It maintains both a normal (global) index, and an object-local index
in the corresponding <code><a href="refH.html#+Hook">+Hook</a></code> object.
See also <a href="ref.html#dbase">Database</a>.

<pre><code>
(rel nm (+Hook2 +IdxFold +String) 3 shop)       # Global and shop-local index
</code></pre>

<dt><a name="has"><code>(has 'any) -> lst</code></a>
<dd>(Debug mode only) Returns a list of all internal symbols which have the
value <code>any</code>. See also <code><a href="refW.html#who">who</a></code>,
<code><a href="refC.html#can">can</a></code>, <code><a
href="refW.html#what">what</a></code> and <code><a
href="refD.html#dep">dep</a></code>.

<pre><code>
: +
-> 270310
: (has 270310)
-> (+ @)
: meth
-> 267259
: (has 267259)
-> (@ js> dec> inc> upd> ele> log> chk> val> del> rel> all> url> zap> clr> str> has>
</code></pre>

<dt><a name="hash"><code>(hash 'any) -> cnt</code></a>
<dd>Generates a 16-bit number (1-65536) from <code>any</code>, suitable as a
hash value for various purposes, like randomly balanced <code><a
href="refI.html#idx">idx</a></code> structures. See also <code><a
href="refC.html#cache">cache</a></code> and <code><a
href="refS.html#seed">seed</a></code>.

<pre><code>
: (hash 0)
-> 1
: (hash 1)
-> 55682
: (hash "abc")
-> 45454
</code></pre>

<dt><a name="hax"><code>(hax 'num) -> sym</code></a>
<dt><code>(hax 'sym) -> num</code>
<dd>Converts a number <code>num</code> to a string in hexadecimal/alpha
notation, or a hexadecimal/alpha formatted string to a number. The digits are
represented with '<code>@</code>' (zero) and the letters '<code>A</code>' -
'<code>O</code>' (from "alpha" to "omega"). This format is used internally for
the names of <code><a href="ref.html#external-io">external symbols</a></code> in
the 64-bit version. See also <code><a href="refF.html#fmt64">fmt64</a></code>,
<code><a href="refH.html#hex">hex</a></code>, <code><a
href="refB.html#bin">bin</a></code> and <code><a
href="refO.html#oct">oct</a></code>.

<pre><code>
: (hax 7)
-> "G"
: (hax 16)
-> "A@"
: (hax 255)
-> "OO"
: (hax "A")
-> 1
</code></pre>

<dt><a name="hd"><code>(hd 'sym ['cnt]) -> NIL</code></a>
<dd>(Debug mode only) Displays a hexadecimal dump of the file given by
<code>sym</code>, limited to <code>cnt</code> lines. See also <code><a
href="refP.html#proc">proc</a></code>.

<pre><code>
:  (hd "lib.l" 4)
00000000  23 20 32 33 64 65 63 30 39 61 62 75 0A 23 20 28  # 23dec09abu.# (
00000010  63 29 20 53 6F 66 74 77 61 72 65 20 4C 61 62 2E  c) Software Lab.
00000020  20 41 6C 65 78 61 6E 64 65 72 20 42 75 72 67 65   Alexander Burge
00000030  72 0A 0A 28 64 65 20 74 61 73 6B 20 28 4B 65 79  r..(de task (Key
-> NIL
</code></pre>

<dt><a name="head"><code>(head 'cnt|lst 'lst) -> lst</code></a>
<dd>Returns a new list made of the first <code>cnt</code> elements of
<code>lst</code>. If <code>cnt</code> is negative, it is added to the length of
<code>lst</code>. If the first argument is a <code>lst</code>, <code>head</code>
is a predicate function returning that argument list if it is <code>equal</code>
to the head of the second argument, and <code>NIL</code> otherwise. See also
<code><a href="refT.html#tail">tail</a></code> and <code><a
href="refP.html#pre?">pre?</a></code>.

<pre><code>
: (head 3 '(a b c d e f))
-> (a b c)
: (head 0 '(a b c d e f))
-> NIL
: (head 10 '(a b c d e f))
-> (a b c d e f)
: (head -2 '(a b c d e f))
-> (a b c d)
: (head '(a b c) '(a b c d e f))
-> (a b c)
</code></pre>

<dt><a name="head/3"><code>head/3</code></a>
<dd><a href="ref.html#pilog">Pilog</a> predicate that succeeds if the first
(string) argument is a prefix of the string representation of the result of
applying the <code><a href="refG.html#get">get</a></code> algorithm to the
following arguments. Typically used as filter predicate in <code><a
href="refS.html#select/3">select/3</a></code> database queries. See also
<code><a href="refP.html#pre?">pre?</a></code>, <code><a
href="refI.html#isa/2">isa/2</a></code>, <code><a
href="refS.html#same/3">same/3</a></code>, <code><a
href="refB.html#bool/3">bool/3</a></code>, <code><a
href="refR.html#range/3">range/3</a></code>, <code><a
href="refF.html#fold/3">fold/3</a></code>, <code><a
href="refP.html#part/3">part/3</a></code> and <code><a
href="refT.html#tolr/3">tolr/3</a></code>.

<pre><code>
: (?
   @Nm "Muller"
   @Tel "37"
   (select (@CuSu)
      ((nm +CuSu @Nm) (tel +CuSu @Tel))
      (tolr @Nm @CuSu nm)
      (head @Tel @CuSu tel) )
   (val @Name @CuSu nm)
   (val @Phone @CuSu tel) )
 @Nm="Muller" @Tel="37" @CuSu={2-3} @Name="Miller" @Phone="37 4773 82534"
-> NIL
</code></pre>

<dt><a name="heap"><code>(heap 'flg) -> cnt</code></a>
<dd>Returns the total size of the cell heap space in megabytes. If
<code>flg</code> is non-<code>NIL</code>, the size of the currently free space
is returned. See also <code><a href="refS.html#stack">stack</a></code> and
<code><a href="refG.html#gc">gc</a></code>.

<pre><code>
: (gc 4)
-> 4
: (heap)
-> 5
: (heap T)
-> 4
</code></pre>

<dt><a name="hear"><code>(hear 'cnt) -> cnt</code></a>
<dd>Uses the file descriptor <code>cnt</code> as an asynchronous command input
channel. Any executable list received via this channel will be executed in the
background. As this mechanism is also used for inter-family communication (see
<code><a href="refT.html#tell">tell</a></code>), <code>hear</code> is usually
only called explicitly by a top level parent process.

<pre><code>
: (call 'mkfifo "fifo/cmd")
-> T
: (hear (open "fifo/cmd"))
-> 3
</code></pre>

<dt><a name="here"><code>(here ['sym]) -> sym</code></a>
<dd>Echoes the current input stream until <code>sym</code> is encountered, or
until end of file. See also <code><a href="refE.html#echo">echo</a></code>.

<pre><code>
$ cat hello.l
(html 0 "Hello" "lib.css" NIL
   (&lt;h2&gt; NIL "Hello")
   (here) )
&lt;p&gt;Hello!&lt;/p&gt;
&lt;p&gt;This is a test.&lt;/p&gt;

$ pil @lib/http.l @lib/xhtml.l hello.l
HTTP/1.0 200 OK
Server: PicoLisp
Date: Sun, 03 Jun 2007 11:41:27 GMT
Cache-Control: max-age=0
Cache-Control: no-cache
Content-Type: text/html; charset=utf-8

&lt;!DOCTYPE html&gt;
&lt;html lang="en"&gt;
&lt;head&gt;
&lt;meta name="viewport" content="width=device-width"/&gt;
&lt;title&gt;Hello&lt;/title&gt;
&lt;link rel="stylesheet" href="http://:/lib.css" type="text/css"/&gt;
&lt;/head&gt;
&lt;body&gt;&lt;h2&gt;Hello&lt;/h2&gt;
&lt;p&gt;Hello!&lt;/p&gt;
&lt;p&gt;This is a test.&lt;/p&gt;
&lt;/body&gt;&lt;/html&gt;
</code></pre>

<dt><a name="hex"><code>(hex 'num ['num]) -> sym</code></a>
<dt><code>(hex 'sym) -> num</code>
<dd>Converts a number <code>num</code> to a hexadecimal string, or a hexadecimal
string <code>sym</code> to a number. In the first case, if the second argument
is given, the result is separated by spaces into groups of such many digits. See
also <code><a href="refB.html#bin">bin</a></code>, <code><a
href="refO.html#oct">oct</a></code>, <code><a
href="refF.html#fmt64">fmt64</a></code>, <code><a
href="refH.html#hax">hax</a></code> and <code><a
href="refF.html#format">format</a></code>.

<pre><code>
: (hex 273)
-> "111"
: (hex "111")
-> 273
: (hex 1234567 4)
-> "12 D687"
</code></pre>

<dt><a name="host"><code>(host 'any) -> sym</code></a>
<dd>Returns the hostname corresponding to the given IP address. See also
<code><a href="refA.html#*Adr">*Adr</a></code>.

<pre><code>
: (host "80.190.158.9")
-> "www.leo.org"
</code></pre>

</dl>

</body>
</html>
